Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cordova/apple/ios): expand import_messages action to generate iOS strings #1683

Merged
merged 11 commits into from
Sep 11, 2023

Conversation

sbruens
Copy link
Contributor

@sbruens sbruens commented Jul 28, 2023

No description provided.

@sbruens sbruens requested a review from a team as a code owner July 28, 2023 23:16
@codecov
Copy link

codecov bot commented Jul 28, 2023

Codecov Report

Patch has no changes to coverable lines.

📢 Thoughts on this report? Let us know!.

@sbruens sbruens changed the title chore(cordova/ios): expand import_messages action to generate iOS strings chore(cordova/apple/ios): expand import_messages action to generate iOS strings Jul 28, 2023
@fortuna fortuna removed the request for review from a team July 29, 2023 20:24
Copy link
Contributor

@daniellacosse daniellacosse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just split up the paths for the STRINGS_DIRs, annoying as that is

src/cordova/android/import_messages.mjs Outdated Show resolved Hide resolved
Comment on lines +25 to +30
return str
.replace(/"/g, '\\"')
.replace(/'/g, "\\'")
.replace(/</g, '\\<')
.replace(/>/g, '\\>;')
.replace(/&/g, '\\&');

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding

This does not escape backslash characters in the input.
Comment on lines +25 to +28
return str
.replace(/"/g, '\\"')
.replace(/'/g, "\\'")
.replace(/</g, '\\<')

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding

This does not escape backslash characters in the input.
Comment on lines +25 to +27
return str
.replace(/"/g, '\\"')
.replace(/'/g, "\\'")

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding

This does not escape backslash characters in the input.
Comment on lines +25 to +26
return str
.replace(/"/g, '\\"')

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding

This does not escape backslash characters in the input.
@sbruens sbruens requested a review from a team as a code owner August 17, 2023 18:32
@github-actions github-actions bot added size/XXL and removed size/XL labels Aug 17, 2023
@fortuna fortuna removed the request for review from a team August 17, 2023 19:03
@github-actions github-actions bot added size/XL and removed size/XXL labels Aug 24, 2023
Copy link
Contributor

@daniellacosse daniellacosse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good, just a couple of minor comments/concerns


function escapeXmlCharacters(str) {
return str
.replace(/"/g, '\\"')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we could probably get all of these in a single pass with reduce

other nit: consider replaceAll https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll

@@ -5,6 +5,7 @@ import PackageDescription

let package = Package(
name: "OutlineAppleLib",
defaultLocalization: "en",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@@ -24,6 +20,8 @@
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.0-debug</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should delete this? It's meant to be injected at build time, but I forget

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we only inject in release mode, and we do so by search and replacing the string. Don't remove it. It also makes it clearer what to expect in the generated file and what we get in dev.

Though, I think there's a way to specify the version only once for all targets. To be investigated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, looking back at the code, you're right. I wonder how this got removed, maybe it was xcode?

<key>CFBundleShortVersionString</key>
<string>0.0.0-debug</string>
<key>CFBundleVersion</key>
<string>0</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with the bundleversion

).end({format: 'object'}).resources.string;
const ANDROID = 'android';
const IOS = 'ios';
const VALID_PLATFORMS = [ANDROID, IOS];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need macos/maccatalyst?

`node-gyp` versions older than v8.0.0 don't work with Python 3.11.
@sbruens sbruens merged commit 1312fc3 into master Sep 11, 2023
13 checks passed
@sbruens sbruens deleted the sbruens/l10n-ios branch September 11, 2023 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants